package cn.zymall.goods.controller;

import cn.zymall.common.controller.crud.BaseController;
import cn.zymall.common.model.SpuBrand;
import cn.zymall.goods.service.SpuBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lxh
 * @Description TODO
 * @date 2020/8/18 23:03
 * @Classname SpuBrandController
 **/
@RestController
@RequestMapping("/spuBrand")
public class SpuBrandController extends BaseController<SpuBrandService, SpuBrand> {

	@Autowired
	private SpuBrandService spuBrandService;

	/**
	 * 查询所有商品品牌
	 * @return
	 */
	@GetMapping("/findAll")
	public List<SpuBrand> findAll() {
		return spuBrandService.findAll();
	}
	/**
	 * 添加商品品牌
	 * @param spuBrand
	 */
	@PostMapping("/add")
	public void add(SpuBrand spuBrand){
		spuBrandService.add(spuBrand);
	}


	/**
	 * 修改商品品牌
	 * @param spuBrand
	 */
	@PostMapping("/amend")
	public void amend(SpuBrand spuBrand){
		spuBrandService.amend(spuBrand);
	}


	/**
	 * 根据id删除商品品牌
	 * @param spuBrand
	 */
	@PostMapping("/del")
	public void del(SpuBrand spuBrand){
		spuBrandService.del(spuBrand);
	}

	@GetMapping("/findAllBrand")
	public List<SpuBrand> findAllBrand() {
		return spuBrandService.findAllBrand();
	}
}
